﻿<!DOCTYPE HTML>
<html>

<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
	<link href="../static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
	<link href="../static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
	<link href="../lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
	<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
	<title>后台登录</title>
</head>

<body>
	<input type="hidden" id="TenantId" name="TenantId" value="" />
	<!--<div class="header"><h2 class="hh">管理员登录</h2></div>-->
	<div class="loginWraper">
		<div id="loginform" class="loginBox">
			<form class="form form-horizontal">
				<div class="row cl">
					<label class="form-label col-xs-3">
						<i class="Hui-iconfont">&#xe60d;</i>
					</label>
					<div class="formControls col-xs-8">
						<input id="input_admin_name" name="" type="text" placeholder="账户" class="input-text size-L">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-3">
						<i class="Hui-iconfont">&#xe60e;</i>
					</label>
					<div class="formControls col-xs-8">
						<input id="input_admin_password" name="" type="password" placeholder="密码" class="input-text size-L">
					</div>
				</div>
				<div class="row cl">
					<div class="formControls col-xs-8 col-xs-offset-3">
						<input id="code_input" class="input-text size-L" type="text" placeholder="验证码" onblur="if(this.value==''){this.value='验证码:'}"
						    onclick="if(this.value=='验证码:'){this.value='';}" value="验证码:" style="width:150px;">
						<div id="v_container" style="width: 200px;height: 40px;display: inline-block;"></div>
					</div>
				</div>
				<div class="row cl">
					<div class="formControls col-xs-8 col-xs-offset-3">
						为了保持更好的浏览效果，建议您使用谷歌，火狐，QQ等浏览器
					</div>
				</div>
				<!--<div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <label for="online">
            <input type="checkbox" name="online" id="online" value="">
            使我保持登录状态</label>
        </div>
      </div>-->
				<div class="row cl">
					<div class="formControls col-xs-8 col-xs-offset-3">
						<input id="my_button" name="" type="button" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
						<input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="footer">Copyright 河北初阳网络科技有限公司</div>
	<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script>
	<script type="text/javascript" src="../lib/md5.min.js"></script>
	<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
	<script src="../js/gVerify.js"></script>
	<script src="../js/config.js"></script>
	<script>
		$.cookie('user__userName', '', { expires: -1,path: '/'});
		$.cookie('user__code', '', { expires: -1 ,path: '/'});
		$.cookie('user_mcno', '', { expires: -1 ,path: '/'});
		$.cookie('userall__code', '', { expires: -1 ,path: '/'});
		$.cookie('cy__userInfo', '', { expires: -1 ,path: '/'});

		var verifyCode = new GVerify("v_container");

		document.getElementById("my_button").onclick = function () {
			var res = verifyCode.validate(document.getElementById("code_input").value);
			if (res) {
				checkmes();
			} else {
				layer.alert("验证码错误");
				$("#code_input").val("");
			}

		}
		$("body").keydown(function () {  
			if (event.keyCode == "13") { //keyCode=13是回车键
				    
				$('#my_button').click();  
			}
		});

		function checkmes() {
			var account = $('#input_admin_name').val();
			var pwd = $('#input_admin_password').val();
			if (account && pwd) {
				$.ajax({
					type: 'POST',
					url: $.webConfig.basicUrl + '/chuyangPay/user/userLogin',
					data: {
						account: account,
						pwd: pwd
					},
					dataType: "json",
					success: function (data) {
						if (data['code'] == 200) {
							console.log(data)

							$.cookie('user__userName', data['date']['account'], {
								expires: 7,
								path: '/'
							});

							$.cookie('user__code', data['date']['md5Code'], {
								expires: 7,
								path: '/'
							});
							$.cookie('user_mcno', data['date']['userMerchantNo'], {
								expires: 7,
								path: '/'
							});
							var code = data['date']['account'] + data['date']['md5Code'];
							$.cookie('userall__code', md5(code), {
								expires: 7,
								path: '/'
							});
							$.cookie('cy__userInfo', JSON.stringify(data['date']), {
								expires: 7,
								path: '/'
							});
							window.location.replace("index.html");
						} else {
							layer.alert(data['msc']);
							$("#code_input").val("");
							$('#input_admin_password').val("");
						}
					},
					error: function (err) {
						console.log(err);
						layer.alert('不好意思，我们的服务器在开小差');
					}
				})

			} else {
				layer.alert('用户名/密码不能为空');
			}
		}
	</script>
</body>

</html>